/*
 * 项目名称:    wms-server-jeecg
 * 创建人员:    FanZhiwen
 * 创建时间:    2023-10-16
 */
package org.jeecg.modules.flow.callback.inbound.other;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.business.warehouse.entity.WmsInReceiptTask;
import org.jeecg.modules.business.warehouse.service.IWmsInReceiptTaskService;
import org.jeecg.modules.flow.callback.enums.DocumentStatusEnum;
import org.jeecg.modules.flow.sys.common.BaseCustomBeanRun;
import org.jeecg.modules.flow.sys.entity.dto.BaseFlowDto;
import org.springframework.stereotype.Component;

/**
 * 条料纵剪结束任务Bean
 *
 * @author FanZhiwen
 * @version 1.0.0
 * @since 2023-10-16
 */
@Component
@Slf4j
@AllArgsConstructor
public class R12EndTaskBeforeBean<T> extends BaseCustomBeanRun<T> {
    private final IWmsInReceiptTaskService iWmsInReceiptTaskService;
    @Override
    public void actureRun() {
        //根据任务id创建入库单
        BaseFlowDto baseFlowDto = this.getBaseFlowDto();
        // 获取请求参数
        String taskId = baseFlowDto.getInfoId();
        iWmsInReceiptTaskService.update(new LambdaUpdateWrapper<WmsInReceiptTask>()
                .set(WmsInReceiptTask::getDocumentStatus, DocumentStatusEnum.COMPLETE.getCode())
                .eq(WmsInReceiptTask::getId,taskId)
        );
    }
}
